package com.example.app_huichuan;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
    private static final int REQUSET_CODE_TO_PICTURE=0XF1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
    }
    private void initView(){
        Button btn=findViewById(R.id.btn_o1);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent(MainActivity.this,app_o2.class);
                intent.putExtra("phone","18888888888");
                startActivityForResult(intent,REQUSET_CODE_TO_PICTURE);
            }
        });
    }
    @Override
    protected void onActivityResult(int requestCode, int resultCode,@Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode==RESULT_OK)
        {
            switch (requestCode)
            {
                case REQUSET_CODE_TO_PICTURE:
                    String result=data.getExtras().getString("new_edit");
                    Toast.makeText(this,"reuslt"+result,Toast.LENGTH_SHORT).show();
                    break;
            }
        }
    }
}